<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style>
    input{}
  </style>
  <title>e网生活管理后台</title>
  <?php  include("common/conn.php");
          mysql_query('SET NAMES UTF8');  
  if($_SESSION['userid']==""){
    echo "<script>window.location.href='login.php';</script>";
  } 

  if($_REQUEST['ch']=="ok")
  { 
    $area = array();
    $area= $_POST['checkbox'];
   
    if( mysql_query("update orders_first set all_rate=$_REQUEST[allRate], first_cateid=$_REQUEST[categroy1], first_rate=$_REQUEST[categroy1_rate], first_use=$_REQUEST[use1_rate], second_cateid=$_REQUEST[categroy2], second_rate=$_REQUEST[categroy2_rate], second_use=$_REQUEST[use2_rate],third_cateid=$_REQUEST[categroy3], third_rate=$_REQUEST[categroy3_rate], third_use=$_REQUEST[use3_rate],fourth_cateid=$_REQUEST[categroy4], fourth_rate=$_REQUEST[categroy4_rate], fourth_use=$_REQUEST[use4_rate] where id=$_REQUEST[ids]") ){
      echo "<script>alert('数据修改成功');</script>";
    }

  }

$order30= mysql_query("select * from orders_first");

  ?>
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <link href="css/styles.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="js/scripts.js"></script>	
</head>

<body>
  <!--header-->
  <?php include("common/header.php");?>
  <!--header end-->
  <div id="sub_nav">

    <div id="subnav_wrap" class="container_12">
      <div id="subnav" class=" grid_12">
        <ul>
          <li> <a href="fenlei.php"> 分类管理 </a></li>
          <li> <a href="fenlei_leixing.php"> 分类属性 </a></li>
          <li><a href="ordersFirst.php" class="sub_nav_active" >首单返券</a></li>
        </ul>
      </div>
    </div>
  </div>
  <div class="container_12">
    <input type="button" class="submit" value="新增使用类型" onclick="add();">
    <b style="color:purple"> （tips: 首单返券比率之和必须为1）</b>
</div>
<!-- end sub_nav -->
<form action="?ch=ok" method="post" onsubmit="return confirm('确定提交修改吗');">
  <!-- EVERYTING BELOW IS THE MAIN CONTENT -->
  <input type="hidden" name="ids" value="<?php echo $order30[id] ?>">
  <div class="container_12">

    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <th width="20%" scope="col">分类名称</th>
       <th width="20%" scope="col">选择类别</th>
       <th width="20%" scope="col">首单返券比率</th>
       <th width="20%" scope="col">使用比率</th>
       <th width="20%" scope="col">操作</th>
      </tr>

      <?php while($rowsf = mysql_fetch_assoc($order30)){ if($rowsf[id]=='1'){?>
      <tr>
        <td width="20%" scope="col">
          <label for=""><input type="text" name="allName" value="<?php echo $rowsf[catename] ?>" readonly /></label>
        </td>
        <td></td>
        <td width="20%" colspan="" scope="col">
            <input size='15' type="text" name="allRate" value='<?php echo $rowsf[first_cate_rate] ?>' readonly /> %
        </td>
        <td width="20%" colspan="" scope="col">
            <input size='15' type="text" name="allRate" value='<?php echo $rowsf[first_cate_use] ?>' readonly /> %
        </td>
        <!-- <td></td> -->
        <td width="20%" scope="col"><a href="addordersFirst.php?q=ok&id=<?php echo $rowsf[id] ?>">编辑</a></td>
      </tr>
      <?php }else{ ?>
      <tr>
        <td width="20%" scope="col">
          <label for=""><input type="text" name="allName" value="<?php echo $rowsf[catename] ?>" readonly/></label>
        </td>
        <td width="20%" scope="col">
          <select name="categroy" >
          <option value="">选择分类</option>
<?php $cate30=mysql_query("select * from categroy ");
      while($rows = mysql_fetch_assoc($cate30)){ ?>
            <option <?php if($rows[cateid]==$rowsf[cateid]) echo 'selected';?> value="<?php echo $rowsf[cateid] ?>"><?php echo $rows[name] ?></option>
<?php      } ?>            
          </select>  
        </td>
        <td width="20%" scope="col">
          <label for=""> <input size='15' type="text" name="categroy_rate" value='<?php echo $rowsf[first_cate_rate] ?>' readonly /> %</label>
        </td>
        <td width="20%" scope="col">
          <label for=""> <input size='15' type="text" name="use_rate" value='<?php echo $rowsf[first_cate_use] ?>' readonly /> %</label>
        </td>
        <td width="20%" scope="col"><a href="addordersFirst.php?id=<?php echo $rowsf[id] ?>">编辑</a></td>
      </tr>
      <?php }} ?>
  </table>

      <!-- END TABULAR DATA EXAMPLE -->



      <div class="grid_12">

        <div class="clearfix"><!-- <input type="submit"  value="提交" class="submit"/> --></div>
<!-- 
        <ul id="pagination">



          <?php  

          if ($page > 1) { //上一页 ?>
          <li><a     href="?page=1&keywords=<?php echo $_REQUEST[keywords]; ?>">首页</a></li>
          <li><a     href="?page=<?php echo ($page-1); ?>&keywords=<?php echo $_REQUEST[keywords]; ?>">上一页</a></li>
          <?php }

          ?>

          <li class="active"><?php echo $page;?></li>

          <?php



          if ($_GET[page]!=$totalPage) { //下一页 ?>
          <li><a     href="?page=<?php echo ($page+1); ?>&keywords=<?php echo $_REQUEST[keywords]; ?>">下一页</a></li>
          <?php }

          if ($totalPage>1) { //下一页 ?>
          <li><a     href="?page=<?php echo $totalPage; ?>&keywords=<?php echo $_REQUEST[keywords]; ?>">尾页</a></li>

          <?php }?>


        </ul> 
-->

      </div>           







    </div>

    <!-- end content wrap -->

  </form>
</body>
<script type="text/javascript">
  function add(){
    window.location.href="addordersFirst.php";
  }
</script>
</html>